package oack1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class Test {

	/**
	 * @param args
	 * @throws SQLException 
	 */
	public static void main(String[] args) throws SQLException {
Connection conn = null;
		
        try
        {
            String userName = "root";
            String password = "pass123";
            String url = "jdbc:mysql://localhost/nostalgia";
            Class.forName ("com.mysql.jdbc.Driver").newInstance ();
            conn = DriverManager.getConnection (url, userName, password);
            System.out.println ("Database connection established");
        }
        catch (Exception e)
        {
            System.err.println ("Cannot connect to database server");
        }
        
        Statement s = conn.createStatement ();
        int count;
        
        ResultSet rs = s.executeQuery ("SELECT * FROM LoginDetail"); 
        while(rs.next()){
        	if(rs.getString("Username").equals("akshit")){
        		if(rs.getString("Password").equals("nanda")){
        			System.out.println("Ok");
        		}
        	}
        }
        

	}

}
